//package tool
//
//import java.io.File
//
//import test.Test.parent
//import utils.{Utils, XmlHandler}
//
//import scala.collection.mutable
//import scala.io.Source
//import scala.xml.pull.{XMLEvent, XMLEventReader}
//
///**
// * Created by Administrator on 2019/8/8
// */
//class MyXmlHandler extends XmlHandler {
//
//  var omimName = ""
//  var disName = ""
//  val startTime = System.currentTimeMillis()
//  override var file = new File(parent, "saliva_metabolites.xml")
//  var i = 0
//
//  case class Info(name: String, disNames: List[String], omimIds: List[String])
//
//  var map = mutable.LinkedHashMap[String, Info]()
//  var accession = ""
//
//
//  override def startDeal(currNode: List[String]): Unit = {
//    currNode match {
//      case List("omim_id", "disease", "diseases", "metabolite", "hmdb") =>
//        omimName = ""
//      case _ => ()
//    }
//  }
//
//  override def endDeal(currNode: List[String]): Unit = {
//    currNode match {
//      case List("omim_id", "disease", "diseases", "metabolite", "hmdb") =>
//        val newOmimIds=map(accession).omimIds:::List(omimName)
//        val newInfo=map(accession).copy(omimIds =newOmimIds )
//        map(accession)=newInfo
//        omimName = ""
//      case List("name", "disease", "diseases", "metabolite", "hmdb") =>
//        val newdisNames=map(accession).disNames:::List(disName)
//        val newInfo=map(accession).copy(disNames =newdisNames )
//        map(accession)=newInfo
//        disName = ""
//      case _ => ()
//    }
//  }
//
//  override def textDeal(text: String, currNode: List[String]): Unit = {
//    i += 1
//    if (i % 1000000 == 0) {
//      println(s"${i}\t${Utils.getTime(startTime)}")
//    }
//
//    currNode match {
//      case List("accession", "metabolite", "hmdb") =>
//        accession = text
//        map += (accession -> new Info("", List[String](), List[String]()))
//      case List("name", "metabolite", "hmdb") =>
//        val newName=map(accession).name+text
//        val newInfo=map(accession).copy(name =newName )
//        map(accession)=newInfo
//      case List("name", "disease", "diseases", "metabolite", "hmdb") =>
//        disName = text
//      case List("omim_id", "disease", "diseases", "metabolite", "hmdb") =>
//        omimName = text
//      case _ => ()
//    }
//  }
//
//
//}
